\hypertarget{bus__tx__queue_8c}{
\section{wmv\_\-bus/bus\_\-tx\_\-queue.c File Reference}
\label{bus__tx__queue_8c}\index{wmv\_\-bus/bus\_\-tx\_\-queue.c@{wmv\_\-bus/bus\_\-tx\_\-queue.c}}
}
FIFO queue for the TXed messages.  


{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include \char`\"{}bus\_\-tx\_\-queue.h\char`\"{}}\par
{\tt \#include \char`\"{}bus.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hypertarget{bus__tx__queue_8c_834b3e9c2dd608f0a57801ec55497d23}{
void \hyperlink{bus__tx__queue_8c_834b3e9c2dd608f0a57801ec55497d23}{tx\_\-queue\_\-init} (void)}
\label{bus__tx__queue_8c_834b3e9c2dd608f0a57801ec55497d23}

\begin{CompactList}\small\item\em Initialize the TX queue. \item\end{CompactList}\item 
void \hyperlink{bus__tx__queue_8c_648e9f6b7ce7bfb76718bbbe1ba1a6e4}{tx\_\-queue\_\-add} (\hyperlink{structBUS__MESSAGE}{BUS\_\-MESSAGE} message)
\begin{CompactList}\small\item\em Insert a message into the TX queue (FIFO). \item\end{CompactList}\item 
\hyperlink{structBUS__MESSAGE}{BUS\_\-MESSAGE} \hyperlink{bus__tx__queue_8c_a377406a7ba00b8abf26c9ddaa92a27c}{tx\_\-queue\_\-get} (void)
\begin{CompactList}\small\item\em Retrieve the first message from the FIFO TX queue. \item\end{CompactList}\item 
void \hyperlink{bus__tx__queue_8c_dbd89dd3f6171e8d1f6f711aad65c04c}{tx\_\-queue\_\-drop} (void)
\item 
void \hyperlink{bus__tx__queue_8c_739012c12a5d250bb930ede0aff10ed6}{tx\_\-queue\_\-dropall} (void)
\begin{CompactList}\small\item\em Erase all content in the TX queue. \item\end{CompactList}\item 
unsigned char \hyperlink{bus__tx__queue_8c_9235743ce41fed36d9875b5c3bd44d55}{tx\_\-queue\_\-is\_\-empty} (void)
\begin{CompactList}\small\item\em Check if the queue is empty. \item\end{CompactList}\item 
unsigned char \hyperlink{bus__tx__queue_8c_2c962b97e835c53d8ef81a5b028839e6}{tx\_\-queue\_\-size} (void)
\begin{CompactList}\small\item\em Get how much of the TX queue that is currently being used. \item\end{CompactList}\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
\hypertarget{bus__tx__queue_8c_969155bf4d8419676bea7602541ad86e}{
unsigned char \hyperlink{bus__tx__queue_8c_969155bf4d8419676bea7602541ad86e}{bus\_\-tx\_\-queue\_\-size}}
\label{bus__tx__queue_8c_969155bf4d8419676bea7602541ad86e}

\begin{CompactList}\small\item\em Variable that keeps track of how much of the TX queue that is being used. \item\end{CompactList}\item 
\hypertarget{bus__tx__queue_8c_bc5de832259e8147141ab3067659ab47}{
\hyperlink{structtx__linked__list}{tx\_\-queue\_\-struct} \hyperlink{bus__tx__queue_8c_bc5de832259e8147141ab3067659ab47}{tx\_\-queue}}
\label{bus__tx__queue_8c_bc5de832259e8147141ab3067659ab47}

\begin{CompactList}\small\item\em The tx queue. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
FIFO queue for the TXed messages. 

FIFO queue for the TXed messages. \begin{Desc}
\item[Author:]Mikael Larsmark, SM2WMV \end{Desc}
\begin{Desc}
\item[Date:]2010-01-25 

\begin{Code}\begin{verbatim} #include "wmv_bus/bus_tx_queue.c" 
\end{verbatim}
\end{Code}

 \end{Desc}


Definition in file \hyperlink{bus__tx__queue_8c-source}{bus\_\-tx\_\-queue.c}.

\subsection{Function Documentation}
\hypertarget{bus__tx__queue_8c_648e9f6b7ce7bfb76718bbbe1ba1a6e4}{
\index{bus\_\-tx\_\-queue.c@{bus\_\-tx\_\-queue.c}!tx\_\-queue\_\-add@{tx\_\-queue\_\-add}}
\index{tx\_\-queue\_\-add@{tx\_\-queue\_\-add}!bus_tx_queue.c@{bus\_\-tx\_\-queue.c}}
\subsubsection[{tx\_\-queue\_\-add}]{\setlength{\rightskip}{0pt plus 5cm}void tx\_\-queue\_\-add ({\bf BUS\_\-MESSAGE} {\em message})}}
\label{bus__tx__queue_8c_648e9f6b7ce7bfb76718bbbe1ba1a6e4}


Insert a message into the TX queue (FIFO). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em message}]- The message that should be inserted to the queue \end{description}
\end{Desc}


Definition at line 56 of file bus\_\-tx\_\-queue.c.

References BUS\_\-TX\_\-QUEUE\_\-SIZE, bus\_\-tx\_\-queue\_\-size, ERROR\_\-TYPE\_\-BUS\_\-TX\_\-QUEUE\_\-FULL, event\_\-set\_\-error(), tx\_\-linked\_\-list::first, tx\_\-linked\_\-list::last, led\_\-set\_\-error(), LED\_\-STATE\_\-ON, and tx\_\-linked\_\-list::message.

Referenced by bus\_\-add\_\-tx\_\-message().\hypertarget{bus__tx__queue_8c_dbd89dd3f6171e8d1f6f711aad65c04c}{
\index{bus\_\-tx\_\-queue.c@{bus\_\-tx\_\-queue.c}!tx\_\-queue\_\-drop@{tx\_\-queue\_\-drop}}
\index{tx\_\-queue\_\-drop@{tx\_\-queue\_\-drop}!bus_tx_queue.c@{bus\_\-tx\_\-queue.c}}
\subsubsection[{tx\_\-queue\_\-drop}]{\setlength{\rightskip}{0pt plus 5cm}void tx\_\-queue\_\-drop (void)}}
\label{bus__tx__queue_8c_dbd89dd3f6171e8d1f6f711aad65c04c}


Drops the first message in the queue Frees up the memory space aswell. 

Definition at line 93 of file bus\_\-tx\_\-queue.c.

References BUS\_\-TX\_\-QUEUE\_\-SIZE, bus\_\-tx\_\-queue\_\-size, and tx\_\-linked\_\-list::first.

Referenced by bus\_\-message\_\-acked(), bus\_\-resend\_\-message(), and bus\_\-send\_\-message().\hypertarget{bus__tx__queue_8c_739012c12a5d250bb930ede0aff10ed6}{
\index{bus\_\-tx\_\-queue.c@{bus\_\-tx\_\-queue.c}!tx\_\-queue\_\-dropall@{tx\_\-queue\_\-dropall}}
\index{tx\_\-queue\_\-dropall@{tx\_\-queue\_\-dropall}!bus_tx_queue.c@{bus\_\-tx\_\-queue.c}}
\subsubsection[{tx\_\-queue\_\-dropall}]{\setlength{\rightskip}{0pt plus 5cm}void tx\_\-queue\_\-dropall (void)}}
\label{bus__tx__queue_8c_739012c12a5d250bb930ede0aff10ed6}


Erase all content in the TX queue. 

\begin{Desc}
\item[Returns:]The number of items that were cleared \end{Desc}


Definition at line 104 of file bus\_\-tx\_\-queue.c.

References bus\_\-tx\_\-queue\_\-size, tx\_\-linked\_\-list::first, and tx\_\-linked\_\-list::last.

Referenced by ISR(), and main().\hypertarget{bus__tx__queue_8c_a377406a7ba00b8abf26c9ddaa92a27c}{
\index{bus\_\-tx\_\-queue.c@{bus\_\-tx\_\-queue.c}!tx\_\-queue\_\-get@{tx\_\-queue\_\-get}}
\index{tx\_\-queue\_\-get@{tx\_\-queue\_\-get}!bus_tx_queue.c@{bus\_\-tx\_\-queue.c}}
\subsubsection[{tx\_\-queue\_\-get}]{\setlength{\rightskip}{0pt plus 5cm}{\bf BUS\_\-MESSAGE} tx\_\-queue\_\-get (void)}}
\label{bus__tx__queue_8c_a377406a7ba00b8abf26c9ddaa92a27c}


Retrieve the first message from the FIFO TX queue. 

\begin{Desc}
\item[Returns:]The first message in the queue \end{Desc}


Definition at line 86 of file bus\_\-tx\_\-queue.c.

References tx\_\-linked\_\-list::first, and tx\_\-linked\_\-list::message.

Referenced by bus\_\-message\_\-acked(), bus\_\-message\_\-nacked(), and bus\_\-send\_\-message().\hypertarget{bus__tx__queue_8c_9235743ce41fed36d9875b5c3bd44d55}{
\index{bus\_\-tx\_\-queue.c@{bus\_\-tx\_\-queue.c}!tx\_\-queue\_\-is\_\-empty@{tx\_\-queue\_\-is\_\-empty}}
\index{tx\_\-queue\_\-is\_\-empty@{tx\_\-queue\_\-is\_\-empty}!bus_tx_queue.c@{bus\_\-tx\_\-queue.c}}
\subsubsection[{tx\_\-queue\_\-is\_\-empty}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char tx\_\-queue\_\-is\_\-empty (void)}}
\label{bus__tx__queue_8c_9235743ce41fed36d9875b5c3bd44d55}


Check if the queue is empty. 

\begin{Desc}
\item[Returns:]1 if the queue is empty and 0 otherwise \end{Desc}


Definition at line 112 of file bus\_\-tx\_\-queue.c.

References tx\_\-linked\_\-list::first, and tx\_\-linked\_\-list::last.

Referenced by main().\hypertarget{bus__tx__queue_8c_2c962b97e835c53d8ef81a5b028839e6}{
\index{bus\_\-tx\_\-queue.c@{bus\_\-tx\_\-queue.c}!tx\_\-queue\_\-size@{tx\_\-queue\_\-size}}
\index{tx\_\-queue\_\-size@{tx\_\-queue\_\-size}!bus_tx_queue.c@{bus\_\-tx\_\-queue.c}}
\subsubsection[{tx\_\-queue\_\-size}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char tx\_\-queue\_\-size (void)}}
\label{bus__tx__queue_8c_2c962b97e835c53d8ef81a5b028839e6}


Get how much of the TX queue that is currently being used. 

\begin{Desc}
\item[Returns:]How much of the queue is being used \end{Desc}


Definition at line 121 of file bus\_\-tx\_\-queue.c.

References bus\_\-tx\_\-queue\_\-size.